Answer:

You would expect to use:

  1. Starting odometer reading,
  2. Ending odometer reading, and
  3. Gallons of gas used between the readings.

Specifications for the Car class

Professional programmers carefully design the classes they need before any coding is done. With well-designed classes programming is much easier and the program has fewer bugs. Object oriented design consists of deciding what classes are needed, what data they will hold, and how they will behave. All these decisions are documented (written up) and then examined. If something doesn't look right, it is fixed before any programming is done. Let us do that with our Car class.


Car

A class that calculates miles per gallon.

Variables

Constructors

Methods


Look at the parameter list for the constructor:

Car( double startOdo, double endingOdo, double gallons );

This says that the constructor must be called with three items of data: three double precision values.

QUESTION 2:

Could a main() method create a Car object?